package com.mianyang.zhangsan.controller;

import com.mianyang.zhangsan.common.base.BaseController;
import com.mianyang.zhangsan.common.base.R;
import com.mianyang.zhangsan.model.entity.SecNotice;
import com.mianyang.zhangsan.service.ISecHallService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * 功能大厅
 * @author jiangjr
 * @date 2023-01-17
 */
@RestController
@RequestMapping("/hall")
public class SecHallController extends BaseController {
    @Autowired
    private ISecHallService hallService;

    @GetMapping("/broad")
    public R broadCast(@RequestParam(value = "top", defaultValue = "10") int top) {
        List<SecNotice> notices = hallService.recentNotice(1, top);
        return success("notice", notices);
    }

    @GetMapping("/recent/policy")
    public R recentPolicy(@RequestParam(value = "top", defaultValue = "10") int top) {
        List<SecNotice> notices = hallService.recentNotice(3, top);
        return success("policy", notices);
    }

    @GetMapping("/recent/video")
    public R recentVideo(@RequestParam(value = "top", defaultValue = "10") int top) {
        List<SecNotice> notices = hallService.recentNotice(2, top);
        return success("video", notices);
    }
}
